﻿<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('@ID("#btn_add_attribute")').click(function (event) {
            event.preventDefault();
            var propNum = jQuery('@ID("#table_attributes") tr').length;
            jQuery('@ID("#table_attributes")').append('<tr>' +
                '<td><input type="text" name="attributes[' + propNum + '].Key" maxlength="100" /></td>' +
                '<td><input type="text" name="attributes[' + propNum + '].Value" maxlength="1000" /></td>' +
                '</tr>');
        });
        jQuery('@ID("#btn_del_attribute")').click(function (event) {
            event.preventDefault();
            jQuery('@ID("#table_attributes") tr:last-child').remove();
        });
    });
</script>
<form id="@ID("form")" action="@Url.Action(Loc.Act("BulkAttributeUpdate").Ctrl("Payment"))" method="post">
    <input type="hidden" name="id" value="@JDM.Int32(Model.EntityID)" />
    <table id="@ID("table_attributes")">
    @{
        int n = 0;
        foreach(var i in Model.Attributes)
        {
            <tr>
                <td>
                    <label>@JDM.String(i.Key)</label>
                    <input type="hidden" name="attributes[@n].Key" value="@JDM.String(i.Key)" />
                </td>
                <td>
                    <input type="text" name="attributes[@n].Value" value="@JDM.String(i.Value)" maxlength="1000" />
                </td>
            </tr>
            n++;
        }
    }
    </table>
    <ul class="bar toolbar">
        <li><button id="@ID("btn_add_attribute")" class="button">+</button></li>
        <li><button id="@ID("btn_del_attribute")" class="button">-</button></li>
        <li><button class="button" type="submit">@T(Res.In("Common").Of("Act").Name("Submit"))</button></li>
    </ul>
</form>